<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>监控配置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" th:href="@{/layui/css/layui.css}" media="all">
    <link rel="stylesheet" href="../../static/style/admin.css" th:href="@{/style/admin.css}" media="all">
    <link rel="stylesheet" href="../../static/style/myself.css" th:href="@{/style/myself.css}" media="all">
    <link rel="stylesheet" href="../../static/lib/jquery-tags-input/jquery.tagsinput.css"
          th:href="@{/lib/jquery-tags-input/jquery.tagsinput.css}" media="all">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.min.js" th:src="@{/js/html5.min.js}"></script>
    <script src="../../static/js/respond.min.js" th:src="@{/js/respond.min.js}"></script>
    <![endif]-->
    <script type="text/javascript" charset="utf-8" th:inline="javascript">
        var ctxPath = /*[[@{/}]]*/'';
        var tokenValue = /*[[${_csrf.token}]]*/'';
    </script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layadmin-homepage-content">
            <form class="layui-form" lay-filter="">
                <div class="layui-card">
                    <!--<div class="layui-card-header div-font-weight">配置</div>-->
                    <!--<div class="layui-card-body" pad20>-->
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title">
                            <li class="layui-this">监控</li>
                            <li>告警</li>
                        </ul>
                        <div class="layui-tab-content">

                            <div class="layui-tab-item layui-show">
                                <div class="layui-card">
                                    <div class="layui-card-header div-font-weight">数据库</div>
                                    <div class="layui-card-body" pad20>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">是否监控</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="dbEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.dbEnable==1}? true : false">
                                            </div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">表空间(Oracle)</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label"
                                                           style="text-align: left;">过载阈值(%)</label>
                                                    <div class="layui-input-block">
                                                        <input type="text" name="dbTableSpaceOverloadThreshold"
                                                               class="layui-input"
                                                               lay-verify="number" lay-verType="tips"
                                                               th:value="${monitorConfigPageForm.dbTableSpaceOverloadThreshold}">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="dbTableSpaceLevel" value="INFO"
                                                               title="INFO"
                                                               th:checked="${monitorConfigPageForm.dbTableSpaceLevel=='INFO'}? true : false">
                                                        <input type="radio" name="dbTableSpaceLevel" value="WARN"
                                                               title="WARN"
                                                               th:checked="${monitorConfigPageForm.dbTableSpaceLevel=='WARN'}? true : false">
                                                        <input type="radio" name="dbTableSpaceLevel" value="ERROR"
                                                               title="ERROR"
                                                               th:checked="${monitorConfigPageForm.dbTableSpaceLevel=='ERROR'}? true : false">
                                                        <input type="radio" name="dbTableSpaceLevel" value="FATAL"
                                                               title="FATAL"
                                                               th:checked="${monitorConfigPageForm.dbTableSpaceLevel=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-card">
                                    <div class="layui-card-header div-font-weight">数链</div>
                                    <div class="layui-card-body" pad20>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">是否监控</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="linkEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.linkEnable==1}? true : false">
                                            </div>
                                            <!--<label class="layui-form-label"-->
                                                   <!--style="text-align: left;width: 60px;">告警阈值</label>-->
                                            <!--<div class="layui-input-block" style="display: flex;">-->
                                                <!--<input type="text" name="linkTime"-->
                                                       <!--style="width: 50px;"-->
                                                       <!--class="layui-input"-->
                                                       <!--lay-verify="number" lay-verType="tips"-->
                                                       <!--th:value="${monitorConfigPageForm.linkTime}">-->
                                                <!--<label style="padding:9px 15px;">分钟</label>-->
                                            <!--</div>-->
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">级别</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="linkSpaceLevel" value="INFO"
                                                       title="INFO"
                                                       th:checked="${monitorConfigPageForm.linkSpaceLevel=='INFO'}? true : false">
                                                <input type="radio" name="linkSpaceLevel" value="WARN"
                                                       title="WARN"
                                                       th:checked="${monitorConfigPageForm.linkSpaceLevel=='WARN'}? true : false">
                                                <input type="radio" name="linkSpaceLevel" value="ERROR"
                                                       title="ERROR"
                                                       th:checked="${monitorConfigPageForm.linkSpaceLevel=='ERROR'}? true : false">
                                                <input type="radio" name="linkSpaceLevel" value="FATAL"
                                                       title="FATAL"
                                                       th:checked="${monitorConfigPageForm.linkSpaceLevel=='FATAL'}? true : false">
                                            </div>
                                        </div>
                                        </div>
                                    </div>


                                <!--<div class="layui-card">-->
                                    <!--<div class="layui-card-header div-font-weight">TCP服务</div>-->
                                    <!--<div class="layui-card-body" pad20>-->
                                        <!--<div class="layui-form-item">-->
                                            <!--<label class="layui-form-label" style="text-align: left;">是否监控</label>-->
                                            <!--<div class="layui-input-inline">-->
                                                <!--<input type="checkbox" name="tcpEnable" lay-text="是|否"-->
                                                       <!--th:value=1 lay-skin="switch"-->
                                                       <!--th:checked="${monitorConfigPageForm.tcpEnable==1}? true : false">-->
                                            <!--</div>-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!--<div class="layui-card">-->
                                    <!--<div class="layui-card-header div-font-weight">HTTP服务</div>-->
                                    <!--<div class="layui-card-body" pad20>-->
                                        <!--<div class="layui-form-item">-->
                                            <!--<label class="layui-form-label" style="text-align: left;">是否监控</label>-->
                                            <!--<div class="layui-input-inline">-->
                                                <!--<input type="checkbox" name="httpEnable" lay-text="是|否"-->
                                                       <!--th:value=1 lay-skin="switch"-->
                                                       <!--th:checked="${monitorConfigPageForm.httpEnable==1}? true : false">-->
                                            <!--</div>-->
                                        <!--</div>-->
                                    <!--</div>-->
                                <!--</div>-->

                                <div class="layui-card">
                                    <div class="layui-card-header div-font-weight">服务器</div>
                                    <div class="layui-card-body" pad20>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">是否监控</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="serverEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.serverEnable==1}? true : false">
                                            </div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">CPU</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label"
                                                           style="text-align: left;">过载阈值(%)</label>
                                                    <div class="layui-input-block">
                                                        <input type="text" name="serverCpuOverloadThreshold"
                                                               class="layui-input"
                                                               lay-verify="number" lay-verType="tips"
                                                               th:value="${monitorConfigPageForm.serverCpuOverloadThreshold}">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="serverCpuLevel" value="INFO"
                                                               title="INFO"
                                                               th:checked="${monitorConfigPageForm.serverCpuLevel=='INFO'}? true : false">
                                                        <input type="radio" name="serverCpuLevel" value="WARN"
                                                               title="WARN"
                                                               th:checked="${monitorConfigPageForm.serverCpuLevel=='WARN'}? true : false">
                                                        <input type="radio" name="serverCpuLevel" value="ERROR"
                                                               title="ERROR"
                                                               th:checked="${monitorConfigPageForm.serverCpuLevel=='ERROR'}? true : false">
                                                        <input type="radio" name="serverCpuLevel" value="FATAL"
                                                               title="FATAL"
                                                               th:checked="${monitorConfigPageForm.serverCpuLevel=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">15分钟负载</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label"
                                                           style="text-align: left;width: 90px;">过载阈值(>0)</label>
                                                    <div class="layui-input-block" style="display: flex;">
                                                        <input type="text" name="serverOverloadThreshold15minutes"
                                                               style="width: 100px;"
                                                               class="layui-input"
                                                               lay-verify="number" lay-verType="tips"
                                                               th:value="${monitorConfigPageForm.serverOverloadThreshold15minutes}">
                                                        <label style="padding:9px 15px;"> × CPU逻辑核数</label>
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="serverOverloadLevel15minutes"
                                                               value="INFO" title="INFO"
                                                               th:checked="${monitorConfigPageForm.serverOverloadLevel15minutes=='INFO'}? true : false">
                                                        <input type="radio" name="serverOverloadLevel15minutes"
                                                               value="WARN" title="WARN"
                                                               th:checked="${monitorConfigPageForm.serverOverloadLevel15minutes=='WARN'}? true : false">
                                                        <input type="radio" name="serverOverloadLevel15minutes"
                                                               value="ERROR" title="ERROR"
                                                               th:checked="${monitorConfigPageForm.serverOverloadLevel15minutes=='ERROR'}? true : false">
                                                        <input type="radio" name="serverOverloadLevel15minutes"
                                                               value="FATAL" title="FATAL"
                                                               th:checked="${monitorConfigPageForm.serverOverloadLevel15minutes=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">内存</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label"
                                                           style="text-align: left;">过载阈值(%)</label>
                                                    <div class="layui-input-block">
                                                        <input type="text" name="serverMemoryOverloadThreshold"
                                                               class="layui-input"
                                                               lay-verify="number" lay-verType="tips"
                                                               th:value="${monitorConfigPageForm.serverMemoryOverloadThreshold}">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="serverMemoryLevel" value="INFO"
                                                               title="INFO"
                                                               th:checked="${monitorConfigPageForm.serverMemoryLevel=='INFO'}? true : false">
                                                        <input type="radio" name="serverMemoryLevel" value="WARN"
                                                               title="WARN"
                                                               th:checked="${monitorConfigPageForm.serverMemoryLevel=='WARN'}? true : false">
                                                        <input type="radio" name="serverMemoryLevel" value="ERROR"
                                                               title="ERROR"
                                                               th:checked="${monitorConfigPageForm.serverMemoryLevel=='ERROR'}? true : false">
                                                        <input type="radio" name="serverMemoryLevel" value="FATAL"
                                                               title="FATAL"
                                                               th:checked="${monitorConfigPageForm.serverMemoryLevel=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">磁盘</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label"
                                                           style="text-align: left;">过载阈值(%)</label>
                                                    <div class="layui-input-block">
                                                        <input type="text" name="serverDiskOverloadThreshold"
                                                               class="layui-input"
                                                               lay-verify="number" lay-verType="tips"
                                                               th:value="${monitorConfigPageForm.serverDiskOverloadThreshold}">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="serverDiskLevel" value="INFO"
                                                               title="INFO"
                                                               th:checked="${monitorConfigPageForm.serverDiskLevel=='INFO'}? true : false">
                                                        <input type="radio" name="serverDiskLevel" value="WARN"
                                                               title="WARN"
                                                               th:checked="${monitorConfigPageForm.serverDiskLevel=='WARN'}? true : false">
                                                        <input type="radio" name="serverDiskLevel" value="ERROR"
                                                               title="ERROR"
                                                               th:checked="${monitorConfigPageForm.serverDiskLevel=='ERROR'}? true : false">
                                                        <input type="radio" name="serverDiskLevel" value="FATAL"
                                                               title="FATAL"
                                                               th:checked="${monitorConfigPageForm.serverDiskLevel=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-card">
                                    <div class="layui-card-header div-font-weight">其他设置</div>
                                    <div class="layui-card-body" pad20>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">网络</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="netEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.netEnable==1}? true : false">
                                            </div>
                                            <label class="layui-form-label" style="text-align: left;">TCP服务</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="tcpEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.tcpEnable==1}? true : false">
                                            </div>
                                            <label class="layui-form-label" style="text-align: left;">HTTP服务</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="httpEnable" lay-text="是|否"
                                                       th:value=1 lay-skin="switch"
                                                       th:checked="${monitorConfigPageForm.httpEnable==1}? true : false">
                                            </div>
                                            <!--<label class="layui-form-label" style="text-align: left;">数链监控</label>-->
                                            <!--<div class="layui-input-inline">-->
                                                <!--<input type="checkbox" name="linkEnable" lay-text="是|否"-->
                                                       <!--th:value=1 lay-skin="switch"-->
                                                       <!--th:checked="${monitorConfigPageForm.linkEnable==1}? true : false">-->
                                            <!--</div>-->
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-tab-item">
                                <div class="layui-card">
                                    <div class="layui-card-header div-font-weight">监控</div>
                                    <div class="layui-card-body" pad20>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" style="text-align: left;">阈值</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="threshold" th:value="${num}" th:title="${num}"
                                                       th:each="num, numStat : ${#numbers.sequence(1,10)}"
                                                       th:checked="${monitorConfigPageForm.threshold==num}? true : false">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">1到10，共10级，值越小监控越灵敏</div>
                                        </div>
                                        <div class="layui-card">
                                            <div class="layui-card-header div-font-weight">告警</div>
                                            <div class="layui-card-body" pad20>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">是否告警</label>
                                                    <div class="layui-input-inline">
                                                        <input type="checkbox" name="alarmEnable" lay-text="是|否"
                                                               th:value=1 lay-skin="switch"
                                                               th:checked="${monitorConfigPageForm.alarmEnable==1}? true : false">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">级别</label>
                                                    <div class="layui-input-block">
                                                        <input type="radio" name="alarmLevel" value="INFO" title="INFO"
                                                               th:checked="${monitorConfigPageForm.alarmLevel=='INFO'}? true : false">
                                                        <input type="radio" name="alarmLevel" value="WARN" title="WARN"
                                                               th:checked="${monitorConfigPageForm.alarmLevel=='WARN'}? true : false">
                                                        <input type="radio" name="alarmLevel" value="ERROR" title="ERROR"
                                                               th:checked="${monitorConfigPageForm.alarmLevel=='ERROR'}? true : false">
                                                        <input type="radio" name="alarmLevel" value="FATAL" title="FATAL"
                                                               th:checked="${monitorConfigPageForm.alarmLevel=='FATAL'}? true : false">
                                                    </div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label" style="text-align: left;">方式</label>
                                                    <div class="layui-input-block">
                                                        <input type="checkbox" name="alarmWay[0]" value="MAIL" title="邮件"
                                                               th:checked="${#arrays.contains(monitorConfigPageForm.alarmWay,'MAIL')}? true : false">
                                                        <input type="checkbox" name="alarmWay[1]" value="SMS" title="短信"
                                                               th:checked="${#arrays.contains(monitorConfigPageForm.alarmWay,'SMS')}? true : false">
                                                    </div>
                                                </div>

                                                <div class="layui-card">
                                                    <div class="layui-card-header div-font-weight">通知</div>
                                                    <div class="layui-card-body" pad20>
                                                        <div class="layui-form-item layui-form-text">
                                                            <label class="layui-form-label"
                                                                   style="text-align: left;">通知人员</label>
                                                            <div id="test1"></div>
                                                    </div>
                                                </div></div>

                                                <!--<div class="layui-card">-->
                                                    <!--<div class="layui-card-header div-font-weight">邮件</div>-->
                                                    <!--<div class="layui-card-body" pad20>-->
                                                        <!--<div class="layui-form-item layui-form-text">-->
                                                            <!--<label class="layui-form-label"-->
                                                                   <!--style="text-align: left;">收件人邮箱</label>-->
                                                            <!--<div class="layui-input-block">-->
                                                        <!--<textarea name="alarmMailEmills" class="layui-textarea tag"-->
                                                                  <!--lay-verType="tips"-->
                                                                  <!--th:text="${monitorConfigPageForm.alarmMailEmills}">-->
                                                        <!--</textarea>-->
                                                                <!--<div class="layui-form-mid layui-word-aux">-->
                                                                    <!--收件人邮箱地址，可输入多个，每输入完一个按下回车-->
                                                                <!--</div>-->
                                                            <!--</div>-->
                                                        <!--</div>-->
                                                    <!--</div>-->
                                                <!--</div>-->

                                                <div class="layui-card">
                                                    <div class="layui-card-header div-font-weight">短信</div>
                                                    <div class="layui-card-body" pad20>
                                                        <div class="layui-form-item layui-form-text">
                                                            <label class="layui-form-label"
                                                                   style="text-align: left;">收信人号码</label>
                                                            <div class="layui-input-block">
                                                        <textarea name="alarmSmsPhoneNumbers" class="layui-textarea tag"
                                                                  lay-verType="tips"
                                                                  th:text="${monitorConfigPageForm.alarmSmsPhoneNumbers}">
                                                        </textarea>
                                                                <div class="layui-form-mid layui-word-aux">
                                                                    收信人手机号码，可输入多个，每输入完一个按下回车
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="layui-form-item">
                                                            <label class="layui-form-label"
                                                                   style="text-align: left;">接口地址</label>
                                                            <div class="layui-input-block">
                                                                <input type="text" name="alarmSmsAddress" class="layui-input"
                                                                       lay-verify="url" lay-verType="tips"
                                                                       th:value="${monitorConfigPageForm.alarmSmsAddress}">
                                                            </div>
                                                        </div>
                                                        <div class="layui-form-item">
                                                            <label class="layui-form-label"
                                                                   style="text-align: left;">接口协议</label>
                                                            <div class="layui-input-block">
                                                                <input type="radio" name="alarmSmsProtocol"
                                                                       th:value="HTTP" th:title="HTTP"
                                                                       th:checked="${monitorConfigPageForm.alarmSmsProtocol=='HTTP'}? true : false">
                                                            </div>
                                                        </div>
                                                        <div class="layui-form-item">
                                                            <label class="layui-form-label"
                                                                   style="text-align: left;">接口企业</label>
                                                            <div class="layui-input-block">
                                                                <input type="radio" name="alarmSmsEnterprise"
                                                                       th:value="PHOENIX" th:title="PHOENIX"
                                                                       th:checked="${monitorConfigPageForm.alarmSmsEnterprise=='PHOENIX'}? true : false">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="config-info">保存
                                </button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                   </div>
                </div>
              </div>
            </form>
        </div>
    </div>
</div>
<script src="../../static/js/common.js" th:src="@{/js/common.js}" charset="utf-8"></script>
<script src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}" charset="utf-8"></script>
<script src="../../static/layui/layui.js" th:src="@{/layui/layui.js}"></script>

<script src="../../static/lib/jquery-tags-input/jquery.tagsinput.js"
        th:src="@{/lib/jquery-tags-input/jquery.tagsinput.js}"></script>
<script src="../../static/lib/jquery-tags-input/tagsinput-init.js"
        th:src="@{/lib/jquery-tags-input/tagsinput-init.js}"></script>
<script charset="utf-8" th:inline="javascript">
    layui.config({
        base: ctxPath //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
    }).use(['index', 'element', 'form', 'util'], function () {
        var admin = layui.admin;
        var form = layui.form;
        var util = layui.util;
        form.render();
        //自定义验证规则
        form.verify({
            url: function (value) {
                if (value != null && value !== '' && !(/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/.test(value))) {
                    return '链接格式不正确';
                }
            }
        });

        // 右下脚回到顶部小图标
        util.fixbar({
            showHeight: 100
        });

        layui.use('transfer', function(){
            var transfer = layui.transfer;
            $.ajax({
                url:ctxPath + 'user/get-monitor-user-lists',
                type:'GET',
                dataType:'JSON',
                success: function (res) {
                    console.log("==========全部用户==========="+JSON.stringify(res.data))
                    console.log("==========长度==========="+JSON.stringify(res.data.length))
                    var dataRight = [];
                    var ConfigID = 1;
                    var data2=res.data;
                    for (var i = 0; i <data2.length ; i++) {
                        if (data2[i].checked==1){
                            dataRight.push(data2[i].id);
                            console.log("==========id==========="+JSON.stringify(dataRight))
                        }
                    }
                    var value1 = dataRight;
                    console.log("==========value1==========="+JSON.stringify(value1))
                    console.log("==========value1==========="+JSON.stringify(ConfigID))
                    //渲染
                    transfer.render({
                        elem: '#test1'  //绑定元素
                        ,title: ['可选用户', '已选用户']
                        ,showSearch: true
                        ,text: {
                            none: '无数据' //没有数据时的文案
                           ,searchNone: '搜索内容无匹配数据' //搜索无匹配数据时的文案
                        }
                        ,data: data2
                        ,value:value1
                        ,id: 'demo1' //定义索引
                        ,parseData: function (res) {
                            return {
                                  "value": res.id //数据值
                                , "title":res.username //数据标题，按返回数据字段名来
                                , "disabled": res.disabled  //是否禁用
                                , "checkeds": res.checkeds //是否选中
                            }
                        },
                        onchange: function (data,index) {
                           var getData = transfer.getData('demo1');
                            console.log("==========数据==========="+JSON.stringify(getData))
                        },
                         height: 400 //定义高度
                    });


                    // 监听信息提交
                    form.on('submit(config-info)', function (data) {
                        console.log("==========保存消息==========="+JSON.stringify(data))
                        // 弹出loading框
                        var loadingIndex = layer.load(1, {
                            shade: [0.1, '#fff'] //0.1透明度的白色背景
                        });
                        admin.req({
                            type: 'delete',
                            url: ctxPath + 'monitor-config/delete-monitor-user-record',
                            data: JSON.stringify(ConfigID),
                            dataType: 'json',
                            contentType: 'application/json;charset=utf-8',
                            headers: {
                                [[${_csrf.headerName}]]: [[${_csrf.token}]]
                            },
                            success: function (result) {
                                console.log("==========result==========="+JSON.stringify(result))
                                //获取穿梭框值
                                var getData = transfer.getData('demo1'); //获取右侧数据
                                console.log("==========当前数据==========="+JSON.stringify(getData))
                                var userID=[]
                                for (var item in getData)
                                {
                                    userID.push(getData[item].value);
                                }
                                console.log("==========userID.length==========="+JSON.stringify(userID.length))
                                if (userID.length >= 1){
                                    console.log("==========userID==========="+JSON.stringify(userID))
                                    admin.req({
                                        type: 'post',
                                        url: ctxPath + 'monitor-config/insert-monitor-user',
                                        data: JSON.stringify(userID),
                                        dataType: 'json',
                                        contentType: 'application/json;charset=utf-8',
                                        headers: {
                                            [[${_csrf.headerName}]]: [[${_csrf.token}]]
                                        },
                                        success: function (result) {
                                            console.log("==========新增日志==========="+JSON.stringify(result))
                                            // 修改用户信息
                                            admin.req({
                                                type: 'put',
                                                url: ctxPath + 'monitor-config/update-monitor-config',
                                                data: data.field,
                                                dataType: 'json',
                                                headers: {
                                                    [[${_csrf.headerName}]]: [[${_csrf.token}]]
                                                },
                                                success: function (result) {
                                                    console.log("==========result.data==========="+JSON.stringify(result.data))
                                                    var data = result.data;
                                                    if (data === webConst.SUCCESS) {
                                                        layer.msg('保存成功！', {icon: 6});
                                                    } else if (data === webConst.REFRESH_FAIL) {
                                                        layer.msg('保存成功，但刷新服务端配置失败，等稍后自动刷新！', {icon: 5, shift: 6});
                                                    } else {
                                                        layer.msg('保存失败！', {icon: 5, shift: 6});
                                                    }
                                                    // 关闭loading框
                                                    layer.close(loadingIndex);
                                                },
                                                error: function () {
                                                    layer.msg('系统错误！', {icon: 5, shift: 6});
                                                    // 关闭loading框
                                                    layer.close(loadingIndex);
                                                },
                                                complete: function () {
                                                    layer.close(loadingIndex);
                                                }
                                            });
                                        }
                                    });
                                }else {
                                    // 修改用户信息
                                    admin.req({
                                        type: 'put',
                                        url: ctxPath + 'monitor-config/update-monitor-config',
                                        data: data.field,
                                        dataType: 'json',
                                        headers: {
                                            [[${_csrf.headerName}]]: [[${_csrf.token}]]
                                        },
                                        success: function (result) {
                                            var data = result.data;
                                            console.log("=========data==========="+JSON.stringify(data))
                                            if (data === webConst.SUCCESS) {
                                                layer.msg('保存成功！', {icon: 6});
                                            } else if (data === webConst.REFRESH_FAIL) {
                                                layer.msg('保存成功，但刷新服务端配置失败，等稍后自动刷新！', {icon: 5, shift: 6});
                                            } else {
                                                layer.msg('保存失败！', {icon: 5, shift: 6});
                                            }
                                            // 关闭loading框
                                            layer.close(loadingIndex);
                                        },
                                        error: function () {
                                            layer.msg('系统错误！', {icon: 5, shift: 6});
                                            // 关闭loading框
                                            layer.close(loadingIndex);
                                        },
                                        complete: function () {
                                            layer.close(loadingIndex);
                                        }
                                    });
                                }
                            }
                        });
                        return false;
                    });
                }
            })
        });

    });
</script>
</body>
</html>
